<?php

class VerMarcacionesProfesorController extends Controller
{
	/**
	 * @var string the default layout for the views. Defaults to '//layouts/column2', meaning
	 * using two-column layout. See 'protected/views/layouts/column2.php'.
	 */
	public $layout='//layouts/column2';
	public $defaultAction='admin';
	/**
	 * @return array action filters
	 */
public function filters()
	{
		return array(
			'rights', // perform access control for CRUD operations
		);
	}

	/**
	 * Specifies the access control rules.
	 * This method is used by the 'accessControl' filter.
	 * @return array access control rules
	 */
	


	/**
	 * Manages all models.
	 */
	public function actionAdmin()
	{
		
		
		$model=new VerMarcacionesProfesor('search');
		$model->unsetAttributes();  // clear any default values
		//if(!Yii::app()->user->checkAccess('admin'))//por ahora le pongo el filtro
			//$model->id = Yii::app()->user->id;
		if(isset($_GET['VerMarcacionesProfesor']))
			$model->attributes=$_GET['VerMarcacionesProfesor'];

		$this->render('admin',array(
			'model'=>$model,
		));
	}

	/**
	 * Returns the data model based on the primary key given in the GET variable.
	 * If the data model is not found, an HTTP exception will be raised.
	 * @param integer $id the ID of the model to be loaded
	 * @return VerMarcacionesProfesor the loaded model
	 * @throws CHttpException
	 */
	public function loadModel($id)
	{
		$model=VerMarcacionesProfesor::model()->findByPk($id);
		if($model===null)
			throw new CHttpException(404,'The requested page does not exist.');
		return $model;
	}

	/**
	 * Performs the AJAX validation.
	 * @param VerMarcacionesProfesor $model the model to be validated
	 */
	protected function performAjaxValidation($model)
	{
		if(isset($_POST['ajax']) && $_POST['ajax']==='ver-marcaciones-profesor-form')
		{
			echo CActiveForm::validate($model);
			Yii::app()->end();
		}
	}


}
